using ValidationFramework.Reflection;

namespace ValidationFramework.Tests
{
	public class MockRule : Rule
	{
		public readonly string errorMessage;
		public	string ruleInterpretation;
		public ValidationError validationResult;
		public 	bool isEquivalent;

		public MockRule()
			: base(null, null, false)
		{
		}
		public MockRule(string errorMessage, string ruleSet, bool useErrorMessageProvider)
			: base(typeof(string).TypeHandle, errorMessage, useErrorMessageProvider)
		{
			this.errorMessage = errorMessage;
		}

		public override string RuleInterpretation
		{
			get
			{
				return ruleInterpretation;
			}
		}

		protected override string GetComputedErrorMessage(string tokenizedMemberName, string descriptorType)
		{
			return errorMessage;
		}

		public override ValidationError Validate(object targetObjectValue, object targetMemberValue, object context, InfoDescriptor infoDescriptor)
		{
			return validationResult;
		}

		public override bool IsEquivalent(Rule rule)
		{
			return isEquivalent;
		}
	}
}